package com.ecnu.system.domain.dto.incubation;

import com.ecnu.common.core.page.PageDomain;
//import com.ecnu.system.domain.dto.SearchConditionDTO;
import com.ecnu.system.domain.dto.SearchConditionDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.AssertTrue;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
public class TransferDTO {
    @ApiModelProperty(value = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    @ApiModelProperty(value = "左侧类型栏结构：数组{‘名称’:list}")
    private Map<String,List<String>> type;

    @ApiModelProperty(value = "条件参数")
    private List<SearchConditionDto> subConditions;

    @ApiModelProperty(value = "页码")
    private PageDomain  pageDomain;
    @AssertTrue(message = "开始时间和结束时间必须同时填写或为空")
    public boolean isTimeRangeValid() {
        return (startTime == null && endTime == null) ||
                (startTime != null && endTime != null);
    }
}
